﻿namespace PayPal.ButtonManager
{
    using System;

    public class ButtonOptionItem
    {
        /// <summary>
        /// The menu item's name
        /// </summary>
        public string SelectName { get; set; }

        /// <summary>
        /// The price associated with each menu item
        /// </summary>
        public string Price { get; set; }

        /// <summary>
        /// The installment cycle unit, which is one of the following values: 
        ///  - NoBillingPeriodType - None (default)
        ///  - Day
        ///  - Week
        ///  - SemiMonth
        ///  - Month
        ///  - Year
        /// </summary>
        public string BillingPeriod { get; set; }

        /// <summary>
        /// The installment cycle frequency in units, 
        /// e.g. if the billing  frequency is 2 and the billing period is Month, 
        /// the billing cycle is every 2 months. The default billing frequency is 1
        /// </summary>
        public int BillingFrequency { get; set; }

        /// <summary>
        /// The total number of billing cycles, regardless of the duration of a cycle; 1 is the default
        /// </summary>
        public int TotalBillingCycles { get; set; }

        /// <summary>
        /// The base amount to bill for the cycle.
        /// </summary>
        public string Amount { get; set; }

        /// <summary>
        /// The shipping amount to bill for the cycle, in addition to the base amount
        /// </summary>
        public string ShippingAmount { get; set; }

        /// <summary>
        /// The tax amount to bill for the cycle, in addition to the base amount
        /// </summary>
        public string TaxAmount { get; set; }

        public static ButtonOptionItem Create(
                                    string name,
                                    string price = "",
                                    string billingPeriod = "",
                                    int billingFrequency = 0,
                                    int totalBillingCycles = 0,
                                    string amount = "",
                                    string shippingAmount = "",
                                    string taxAmount = "")
        {
            return new ButtonOptionItem
                                        {
                                            SelectName = name,
                                            Price = price,
                                            BillingPeriod = billingPeriod,
                                            BillingFrequency = billingFrequency,
                                            TotalBillingCycles = totalBillingCycles,
                                            Amount = amount,
                                            ShippingAmount = shippingAmount,
                                            TaxAmount = taxAmount
                                        };
        }
    }
}
